package com.xbongbong.saas.script.tempenum;

import com.alibaba.fastjson.JSONObject;
import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.paas.enums.DateTimeEnum;
import com.xbongbong.paas.help.FormDataFormExplainHelper;
import com.xbongbong.paas.field.DefaultAttrPoJo;
import com.xbongbong.paas.field.FieldAttrEntity;
import com.xbongbong.paas.field.FormulaPoJo;
import com.xbongbong.paas.field.ItemPoJo;
import com.xbongbong.paas.field.LinkDetailPojo;
import com.xbongbong.paas.field.NumericalLimitsPoJo;
import com.xbongbong.paas.field.SerialNumberPoJo;
import com.xbongbong.pro.enums.AmountFlagEnum;
import com.xbongbong.pro.enums.ReceiveStatusEnum;
import com.xbongbong.pro.enums.SaasMarkEnum;
import com.xbongbong.pro.enums.SummaryTypeEnum;
import com.xbongbong.paas.field.SaasParticularAttributePoJo;
import com.xbongbong.saas.constant.BasicConstant;
import com.xbongbong.saas.constant.StringConstant;
import com.xbongbong.saas.enums.ForbiddenSettingEnum;
import com.xbongbong.saas.enums.RedundantTemplateTypeEnum;
import com.xbongbong.saas.enums.SelectProductEnum;
import com.xbongbong.saas.enums.ShowTypeEnum;
import com.xbongbong.saas.enums.XbbRefTypeEnum;
import com.xbongbong.saas.enums.business.PurchaseEnum;
import com.xbongbong.saas.enums.dictionary.PayMethodEnum;
import com.xbongbong.saas.enums.dictionary.PurchaseStatusEnum;
import com.xbongbong.saas.script.help.InitExplainsHelper;
import com.xbongbong.sys.enums.RoleEnum;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

/**
 * 采购合同
 * @author Jian.Wang
 * @date 2019/1/17
 * @since v1.0
 * @version v1.0
 */
@Getter
public enum TempPurchaseEnum {
    //
    BASE_INFO(PurchaseEnum.BASE_INFO),
    SHEET_NO(PurchaseEnum.SHEET_NO),
    PURCHASE_NAME(PurchaseEnum.PURCHASE_NAME),
    SUPPLIER_ID(PurchaseEnum.SUPPLIER_ID),
    PAY_METHOD(PurchaseEnum.PAY_METHOD),
    STATUS(PurchaseEnum.STATUS),
    RECEIVE_STATUS(PurchaseEnum.RECEIVE_STATUS),
    SIGNER_ID(PurchaseEnum.SIGNER_ID),
    SIGN_TIME(PurchaseEnum.SIGN_TIME),
    ESTIMATE_ARRIVE_TIME(PurchaseEnum.ESTIMATE_ARRIVE_TIME),
    MEMO(PurchaseEnum.MEMO),
    OWNER_ID(PurchaseEnum.OWNER_ID),
    COUSERID(PurchaseEnum.COUSERID),


    PURCHASE_INFO(PurchaseEnum.PURCHASE_INFO),
    PRODUCT(PurchaseEnum.PRODUCT),
    PRODUCT_TOTAL(PurchaseEnum.PRODUCT_TOTAL),
    DISCOUNT_MONEY(PurchaseEnum.DISCOUNT_MONEY),
    DISCOUNT_AMOUNT(PurchaseEnum.DISCOUNT_AMOUNT),
    TOTAL_MONEY(PurchaseEnum.TOTAL_MONEY),
    BAD_AMOUNT(PurchaseEnum.BAD_AMOUNT),

    ASSOCIATED_INFO(PurchaseEnum.ASSOCIATED_INFO),
    ADD_WRITE_OFF_PREPAYMENT(PurchaseEnum.ADD_WRITE_OFF_PREPAY),
    ADD_PAYMENT_SHEET(PurchaseEnum.ADD_PAY_SHEET),
    ADD_PAYPLAN(PurchaseEnum.ADD_PAYPLAN),

    SYSTEM_INFO(PurchaseEnum.SYSTEM_INFO),
    CREATOR_ID(PurchaseEnum.CREATOR_ID),
    ADD_TIME(PurchaseEnum.ADD_TIME),
    UPDATE_TIME(PurchaseEnum.UPDATE_TIME),

    FINISH_AMOUNT(PurchaseEnum.FINISH_AMOUNT),
    UN_FINISH_AMOUNT(PurchaseEnum.UN_FINISH_AMOUNT),
    RECEINE_PERCENT(PurchaseEnum.RECEINE_PERCENT),
    INVOICE_AMOUNT(PurchaseEnum.INVOICE_AMOUNT),
    UN_INVOICE_AMOUNT(PurchaseEnum.UN_INVOICE_AMOUNT),

    REF_ID(PurchaseEnum.REF_ID),
    INSTOCK_ID(PurchaseEnum.INSTOCK_ID),
    RETURNED_PURCHASE_ID(PurchaseEnum.RETURNED_PURCHASE_ID),
    ALL_INCOMING(PurchaseEnum.ALL_INCOMING),
    SUPPLIER_ID_LINKED_TEXT(PurchaseEnum.SUPPLIER_ID_LINKED_TEXT),
    SIGNER_ID_LINKED_TEXT(PurchaseEnum.SIGNER_ID_LINKED_TEXT),


    ;

    private PurchaseEnum anEnum;

    TempPurchaseEnum(PurchaseEnum purchaseEnum) {
        this.anEnum = purchaseEnum;
    }

    public static List<TempPurchaseEnum> getAllEnum() {
        List<TempPurchaseEnum> list = new ArrayList<>();
        Collections.addAll(list, values());
        return list;
    }

    public static void initPurchaseName(FieldAttrEntity fieldAttrEntity){
        LinkDetailPojo linkDetailPojo = new LinkDetailPojo();
        linkDetailPojo.setBusinessType(XbbRefTypeEnum.PURCHASE.getCode());
        linkDetailPojo.setSubBuisenssType(XbbRefTypeEnum.PURCHASE.getCode());
        linkDetailPojo.setSaasMark(SaasMarkEnum.SAAS.getCode());
        linkDetailPojo.setAttr(PURCHASE_NAME.getAnEnum().getAttr());
        fieldAttrEntity.setLinkDetail(linkDetailPojo);
    }

    /**
     * 初始化采购合同编号
     *
     * @param fieldAttrEntity 字段解释实体--saas专用
     */
    public static void initSheetNo(FieldAttrEntity fieldAttrEntity){
        LinkDetailPojo linkDetailPojo = new LinkDetailPojo();
        linkDetailPojo.setBusinessType(XbbRefTypeEnum.PURCHASE.getCode());
        linkDetailPojo.setSubBuisenssType(XbbRefTypeEnum.PURCHASE.getCode());
        linkDetailPojo.setSaasMark(SaasMarkEnum.SAAS.getCode());
        linkDetailPojo.setAttr(SHEET_NO.getAnEnum().getAttr());
        fieldAttrEntity.setLinkDetail(linkDetailPojo);
        // 不能重复
        fieldAttrEntity.setNoRepeat(1);
        // 默认的编号规则
        SerialNumberPoJo serialNumberPoJo = InitExplainsHelper.setSerialNumber(SerialNumberEnum.PURCHASE_NO);
        fieldAttrEntity.setSerialNumber(serialNumberPoJo);
        fieldAttrEntity.setIsForbidden(0);
    }

    /**
     * 初始化支付方式
     * @author Jian.Wang
     * @date 2019/2/15 14:25
     */
    public static void initPayMethod(FieldAttrEntity fieldAttrEntity) {
//        String str = "网银转账,支票,现金,承兑发票,电汇,支付宝,QQ";
        fieldAttrEntity.setItems(InitExplainsHelper.setCombItemByEnum(PayMethodEnum.class, fieldAttrEntity.getFieldType()));
        fieldAttrEntity.setDictionaryFlag(1);
    }
    /**
     * 初始化状态
     * @author Jian.Wang
     * @date 2019/2/15 14:25
     */
    public static void initStatus(FieldAttrEntity fieldAttrEntity) {
//        Map<String, String> purchaseStatusMap = PurchaseStatusEnum.getPurchaseStatusMap();
//        fieldAttrEntity.setItems(InitExplainsHelper.setCombItemByStringMap(purchaseStatusMap));
        fieldAttrEntity.setItems(InitExplainsHelper.setCombItemByEnum(PurchaseStatusEnum.class, fieldAttrEntity.getFieldType()));
        fieldAttrEntity.setDictionaryFlag(0);
        fieldAttrEntity.setIsForbidden(0);
    }
    /**
     * 初始化关联供应商
     *
     * @param fieldAttrEntity 字段解释实体--saas专用
     */
    public static void initSupplierId(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setLinkedType(RedundantTemplateTypeEnum.SUPPLIER.getCode());
        fieldAttrEntity.setLinkedText(SUPPLIER_ID_LINKED_TEXT.getAnEnum().getAttr());
        SaasParticularAttributePoJo saasParticularAttributePoJo = new SaasParticularAttributePoJo();
        saasParticularAttributePoJo.setMultiCheck(false);
        fieldAttrEntity.setSaasParticularAttributePoJo(saasParticularAttributePoJo);

        saasParticularAttributePoJo.setRelyType("base");
        saasParticularAttributePoJo.setRelyMode("customer");
        saasParticularAttributePoJo.setRelySubModel("supplier");
        fieldAttrEntity.setSaasParticularAttributePoJo(saasParticularAttributePoJo);
        fieldAttrEntity.setIsForbidden(0);
    }

    /**
     * 采购产品
     * @param fieldAttrEntity 字段解释实体--saas专用
     */
    public static void initProducts(FieldAttrEntity fieldAttrEntity) {
        SaasParticularAttributePoJo saasParticularAttributePoJo = new SaasParticularAttributePoJo();
        saasParticularAttributePoJo.setRelyType("relied");
        saasParticularAttributePoJo.setRelyMode("customer");
        saasParticularAttributePoJo.setRelySubModel("supplier");
        fieldAttrEntity.setSaasParticularAttributePoJo(saasParticularAttributePoJo);
        fieldAttrEntity.setSetType(BasicConstant.THREE);
        fieldAttrEntity.setIsForbidden(BasicConstant.ONE);
    }

    /**
     * 初始化添加回款
     *
     * @param fieldAttrEntity 字段
     * @author feng.zheng
     * @return void
     * @date 2019/2/20 19:06
     */
    public static void initAddPayPlan(FieldAttrEntity fieldAttrEntity) {
        SaasParticularAttributePoJo saasParticularAttributePoJo = new SaasParticularAttributePoJo();
        saasParticularAttributePoJo.setLinkBusinessType(XbbRefTypeEnum.PAY_PLAN.getCode());
        fieldAttrEntity.setSaasParticularAttributePoJo(saasParticularAttributePoJo);
        fieldAttrEntity.setNumericalLimitsFlag(1);
        fieldAttrEntity.setNumericalLimits(new NumericalLimitsPoJo(0D,50D));
    }

    public static void initTotalMoney(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setSummaryFlag(1);
        fieldAttrEntity.setAmountFlag(AmountFlagEnum.YES.getType());
        fieldAttrEntity.setMemo("默认值=产品合计+其他费用-优惠金额");
        DefaultAttrPoJo defaultAttrPoJo = new DefaultAttrPoJo();
        FormulaPoJo formulaInfo = new FormulaPoJo();
        String formula = "SUM({self." + PurchaseEnum.PRODUCT_TOTAL.getAttr() + "},{self." + PurchaseEnum.DISCOUNT_MONEY.getAttr() + "})-{self." + PurchaseEnum.DISCOUNT_AMOUNT.getAttr() + "}";
        JSONObject labelMap = new JSONObject();
        labelMap.put("self." + PurchaseEnum.PRODUCT_TOTAL.getAttr(), PurchaseEnum.PRODUCT_TOTAL.getAttrName());
        labelMap.put("self." + PurchaseEnum.DISCOUNT_MONEY.getAttr(), PurchaseEnum.DISCOUNT_MONEY.getAttrName());
        labelMap.put("self." + PurchaseEnum.DISCOUNT_AMOUNT.getAttr(), PurchaseEnum.DISCOUNT_AMOUNT.getAttrName());
        formulaInfo.setFormula(formula);
        formulaInfo.setLabelMap(labelMap);
        defaultAttrPoJo.setDefaultType("formula");
        defaultAttrPoJo.setFormulaInfo(formulaInfo);
        fieldAttrEntity.setDefaultAttr(defaultAttrPoJo);
        fieldAttrEntity.setIsForbidden(0);
    }

    public static void initSignTime(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setDateType(DateTimeEnum.TIME.getType());
        fieldAttrEntity.setIsForbidden(0);
    }

    public static void initSignId(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setIsForbidden(0);
    }

    public static void initEstimateArriveTime(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setDateType(DateTimeEnum.TIME.getType());
        fieldAttrEntity.setIsForbidden(0);
    }

    /**
     * 负责人
     * @param fieldAttrEntity
     */
    public static void initOwnerId(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setMultiple(1);
        fieldAttrEntity.setRequired(1);
        //可新增权限：默认【超级管理员、销售主管、创建人、负责人、负责人主管】可新增负责人，支持自定义；
        fieldAttrEntity.setShowEditable(0);
        fieldAttrEntity.setAdd(1);
        fieldAttrEntity.setAddAdvanceEnable(1);
        fieldAttrEntity.setShowAdd(1);
        //可删除权限：默认【超级管理员、销售主管】可删除负责人，支持自定义；
        fieldAttrEntity.setRemove(1);
        fieldAttrEntity.setRemoveAdvanceEnable(1);
        fieldAttrEntity.setShowRemove(1);
        fieldAttrEntity.setIsForbidden(0);
        fieldAttrEntity.setEditable(1);
        fieldAttrEntity.setUnableEditMemo(null);
        fieldAttrEntity.setAddRule(FormDataFormExplainHelper.getDefaultRule(RoleEnum.PURCHASE_MANAGER));
        fieldAttrEntity.setRemoveRule(FormDataFormExplainHelper.getDefaultRule(RoleEnum.PURCHASE_MANAGER));
    }

    public static void initCoUserId(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setRequired(0);
        //可新增权限：默认【超级管理员、销售主管、创建人、负责人、负责人主管】可新增协同人，支持自定义；
        fieldAttrEntity.setShowEditable(0);
        fieldAttrEntity.setAdd(1);
        fieldAttrEntity.setAddAdvanceEnable(1);
        fieldAttrEntity.setShowAdd(1);
        fieldAttrEntity.setRemove(1);
        fieldAttrEntity.setRemoveAdvanceEnable(1);
        fieldAttrEntity.setShowRemove(1);
        fieldAttrEntity.setIsForbidden(0);
        fieldAttrEntity.setEditable(1);
        fieldAttrEntity.setUnableEditMemo(null);
        fieldAttrEntity.setAddRule(FormDataFormExplainHelper.getDefaultRule(RoleEnum.PURCHASE_MANAGER));
        fieldAttrEntity.setRemoveRule(FormDataFormExplainHelper.getDefaultRule(RoleEnum.PURCHASE_MANAGER));
    }

    public static void initProductTotal(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setMemo("默认值为采购单价汇总");
        fieldAttrEntity.setSummaryFlag(SummaryTypeEnum.SUM.getType());
        fieldAttrEntity.setAmountFlag(AmountFlagEnum.YES.getType());
        fieldAttrEntity.setEditable(0);
        DefaultAttrPoJo defaultAttrPoJo = new DefaultAttrPoJo();
        FormulaPoJo formulaInfo = new FormulaPoJo();
        String formula = "SUM({self." + PurchaseEnum.PRODUCT.getAttr() + "." + SelectProductEnum.SUBTOTAL.getAttr() + "})";
        JSONObject labelMap = new JSONObject();
        labelMap.put("self." + PurchaseEnum.PRODUCT.getAttr() + "." + SelectProductEnum.SUBTOTAL.getAttr(), "关联产品.单价小计");
        formulaInfo.setFormula(formula);
        formulaInfo.setLabelMap(labelMap);
        defaultAttrPoJo.setDefaultType("formula");
        defaultAttrPoJo.setFormulaInfo(formulaInfo);
        fieldAttrEntity.setDefaultAttr(defaultAttrPoJo);
        // 合同金额默认限定 0 ~ 100000000000
        NumericalLimitsPoJo numericalLimits = new NumericalLimitsPoJo();
        numericalLimits.setMin(0D);
        numericalLimits.setMax(100000000000D);
        fieldAttrEntity.setNumericalLimits(numericalLimits);
        fieldAttrEntity.setNumericalLimitsFlag(1);
    }

    public static void initDiscountMoney(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setSummaryFlag(SummaryTypeEnum.SUM.getType());
        fieldAttrEntity.setAmountFlag(AmountFlagEnum.YES.getType());
    }

    public static void initDiscountAmount(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setSummaryFlag(SummaryTypeEnum.SUM.getType());
        fieldAttrEntity.setAmountFlag(AmountFlagEnum.YES.getType());
    }

    public static void initCreatorId(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setEditable(0);
        fieldAttrEntity.setUnableEditMemo(I18nMessageUtil.getMessage(StringConstant.AUTO_GEN_FIELD));
    }

    public static void initAddTime(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setEditable(0);
        fieldAttrEntity.setUnableEditMemo(I18nMessageUtil.getMessage(StringConstant.AUTO_GEN_FIELD));
    }
    public static void initUpdateTime(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setEditable(0);
        fieldAttrEntity.setUnableEditMemo(I18nMessageUtil.getMessage(StringConstant.AUTO_GEN_FIELD));
    }

    public static void initSignerId(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setIsForbidden(0);
    }

    public static void initReceiveStatus(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setIsDictionary(1);
        List<ItemPoJo> itemPoJos = InitExplainsHelper.setCombItemByEnum(ReceiveStatusEnum.class, fieldAttrEntity.getFieldType());
        List<String> shipStatusCodeList = Arrays.asList(ReceiveStatusEnum.UNRECEIVED.getName(), ReceiveStatusEnum.PARTIAL.getName(), ReceiveStatusEnum.RECEIVED.getName(), ReceiveStatusEnum.CLOSED.getName());
        for (ItemPoJo itemPoJo: itemPoJos) {
            itemPoJo.setNoDel(1);
            itemPoJo.setNoEdit(1);
            if (!shipStatusCodeList.contains(itemPoJo.getText())) {
                itemPoJo.setShowType(ShowTypeEnum.NONE.getCode());
                itemPoJo.setEditHide(1);
            } else {
                if (Objects.equals(itemPoJo.getText(), ReceiveStatusEnum.UNRECEIVED.getName())) {
                    itemPoJo.setChecked(true);
                }
            }
        }
        List<String> settingList = Arrays.asList(ForbiddenSettingEnum.DISABLE_OPTION_RELY.getAlias(), ForbiddenSettingEnum.DISABLE_SELF_DEFINE.getAlias());
        fieldAttrEntity.setForbiddenSettingList(settingList);
        fieldAttrEntity.setItemBanDefault(1);
        fieldAttrEntity.setItems(itemPoJos);
        fieldAttrEntity.setShowEditable(0);
        fieldAttrEntity.setEditable(0);
    }

    /**
     * 处理坏账金额
     * @param fieldAttrEntity
     * @author chenshan
     * @return void
     * @date 2019-11-26 15:36
     */
    public static void initBadAmount(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setSummaryFlag(SummaryTypeEnum.SUM.getType());
        fieldAttrEntity.setAmountFlag(AmountFlagEnum.YES.getType());
        fieldAttrEntity.setEditable(0);
        fieldAttrEntity.setUnableEditMemo(I18nMessageUtil.getMessage(StringConstant.AUTO_GEN_FIELD));
        fieldAttrEntity.setIsForbidden(0);
    }

    /**
     * 初始化添加付款单
     *
     * @param fieldAttrEntity 字段
     * @author chenshan
     * @return void
     * @date 2020-02-12 15:36
     */
    public static void initAddPaySheet(FieldAttrEntity fieldAttrEntity) {
        SaasParticularAttributePoJo saasParticularAttributePoJo = new SaasParticularAttributePoJo();
        saasParticularAttributePoJo.setLinkBusinessType(XbbRefTypeEnum.PAY_SHEET.getCode());
        fieldAttrEntity.setSaasParticularAttributePoJo(saasParticularAttributePoJo);
        fieldAttrEntity.setNumericalLimitsFlag(1);
        fieldAttrEntity.setNumericalLimits(new NumericalLimitsPoJo(0D,50D));
        fieldAttrEntity.setIsOpen(1);
    }

    /**
     * 初始化添加核销预收款
     *
     * @param fieldAttrEntity 字段
     * @author chenshan
     * @return void
     * @date 2020-02-12 15:36
     */
    public static void initAddWriteOffPrepay(FieldAttrEntity fieldAttrEntity) {
        SaasParticularAttributePoJo saasParticularAttributePoJo = new SaasParticularAttributePoJo();
        saasParticularAttributePoJo.setLinkBusinessType(XbbRefTypeEnum.WRITE_OFF_PREPAY.getCode());
        fieldAttrEntity.setSaasParticularAttributePoJo(saasParticularAttributePoJo);
        fieldAttrEntity.setNumericalLimitsFlag(1);
        fieldAttrEntity.setNumericalLimits(new NumericalLimitsPoJo(0D,50D));
        fieldAttrEntity.setIsOpen(0);
    }

    /**
     * 初始化实付金额
     * @param fieldAttrEntity
     * @author chenshan
     * @return void
     * @date 2020-02-12 15:36
     */
    public static void initFinishAmount(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setSummaryFlag(SummaryTypeEnum.SUM.getType());
        fieldAttrEntity.setAmountFlag(AmountFlagEnum.YES.getType());
        fieldAttrEntity.setEditable(0);
        fieldAttrEntity.setUnableEditMemo(I18nMessageUtil.getMessage(StringConstant.AUTO_GEN_FIELD));
        fieldAttrEntity.setIsForbidden(0);
    }
    /**
     * 初始化未实付金额
     * @param fieldAttrEntity
     * @author chenshan
     * @return void
     * @date 2020-02-12 15:36
     */
    public static void initUnFinishAmount(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setSummaryFlag(SummaryTypeEnum.SUM.getType());
        fieldAttrEntity.setAmountFlag(AmountFlagEnum.YES.getType());
        fieldAttrEntity.setEditable(0);
        fieldAttrEntity.setUnableEditMemo(I18nMessageUtil.getMessage(StringConstant.AUTO_GEN_FIELD));
        fieldAttrEntity.setIsForbidden(0);
    }
    /**
     * 初始化收款比例
     * @param fieldAttrEntity
     * @author chenshan
     * @return void
     * @date 2020-02-12 15:36
     */
    public static void initReceivePrecent(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setEditable(0);
        fieldAttrEntity.setUnableEditMemo(I18nMessageUtil.getMessage(StringConstant.AUTO_GEN_FIELD));
        fieldAttrEntity.setIsForbidden(0);
    }
    /**
     * 初始化开票金额
     * @param fieldAttrEntity
     * @author chenshan
     * @return void
     * @date 2020-02-12 15:36
     */
    public static void initInvoiceAmount(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setSummaryFlag(SummaryTypeEnum.SUM.getType());
        fieldAttrEntity.setAmountFlag(AmountFlagEnum.YES.getType());
        fieldAttrEntity.setEditable(0);
        fieldAttrEntity.setUnableEditMemo(I18nMessageUtil.getMessage(StringConstant.AUTO_GEN_FIELD));
        fieldAttrEntity.setIsForbidden(0);
    }
    /**
     * 初始化未开票金额
     * @param fieldAttrEntity
     * @author chenshan
     * @return void
     * @date 2020-02-12 15:36
     */
    public static void initUnInvoiceAmount(FieldAttrEntity fieldAttrEntity) {
        fieldAttrEntity.setSummaryFlag(SummaryTypeEnum.SUM.getType());
        fieldAttrEntity.setAmountFlag(AmountFlagEnum.YES.getType());
        fieldAttrEntity.setEditable(0);
        fieldAttrEntity.setUnableEditMemo(I18nMessageUtil.getMessage(StringConstant.AUTO_GEN_FIELD));
        fieldAttrEntity.setIsForbidden(0);
    }
}
